from .models import Discussion,QualityEvent
from helpers.director.shortcut import director_view,ModelFields,director,ModelTable,PageNum,RowSort

class DiscussionUserForm(ModelFields):
    nolimit = True
    class Meta:
        model = Discussion
        exclude =[]

    def clean_dict(self, dc):
        dc['user'] = self.crt_user.pk
        return dc
        

class DiscussionUserTable(ModelTable):
    model = Discussion
    exclude =[]
    nolimit = True
    def inn_filter(self, query):
        return query.filter(event_id=self.kw.get('event'))
    class pagenator(PageNum):
        perPage=2000
    class sort(RowSort):
        general_sort ='pk'


director.update({
    'user-discussion':DiscussionUserForm,
    'user-discussion-list':DiscussionUserTable
}) 